<template>
    <div class="titleFont">
        <el-card style="font-weight: bold">
            营销计划
        </el-card>
         <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="销售年计划" name="销售年计划">
              <router-view v-if="activeName == '销售年计划'"></router-view>
            </el-tab-pane>
            <el-tab-pane label="销售月计划" name="销售月计划">
              <router-view v-if="activeName == '销售月计划'"></router-view>
            </el-tab-pane>
        </el-tabs>
    </div>
</template>

<script>
export default {
  data() {
    return {
      activeName: '销售年计划'
    }
  },
  mounted(){
    let { isYear = false } = this.$route.meta
    this.activeName = isYear ? '销售年计划' : '销售月计划'
  },
  methods:{
    handleClick(tab,event){
      '销售月计划' == this.activeName ? this.$router.push({ name: 'monthPlan' }) : this.$router.push({ name: 'yearPlan' })
    }
  }
}
</script>

